﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ESP
{
    public class MaximizeFit : IComparer
    {
        public int Compare(Object x, Object y)
        {
            if (x is Neuron && y is Neuron)
            {
                if (((Neuron) x).fitness < ((Neuron) y).fitness)
                {
                    return 1;
                }
                else if (((Neuron) x).fitness > ((Neuron) y).fitness)
                {
                    return -1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                throw new InvalidCastException();
            }
        }

        public bool equals(Object obj)
        {
            return this.GetType() == obj.GetType();
        }
    }
}
